public class ThreadDemo5 {
    public static void main(String[] args) {
        //lambda表达式这个写法代替了Runnable重新run方法.
        //
        Thread t = new Thread(() ->{
            while(!Thread.currentThread().isInterrupted()) {
                {
                    System.out.println("正在运行,Thread");
                    try {
                        Thread.sleep(1001);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }

        });
//        System.out.println(t.getName() + "的ID :" + t.getId());
//        System.out.println(t.getName() + "的名称 :" + t.getName());
//        System.out.println(t.getName() + "的状态 :" + t.getState());
//        System.out.println(t.getName() + "的优先级 :" + t.getPriority());
//        System.out.println(t.getName() + "是否为后台线程 :" + t.isDaemon());


        //启动新创建的线程
        t.start();
       //t.interrupt();


        System.out.println("hello main");
    }
}
